package com.butnet.sqltools.connection;

public class UncaseString {
	private String str=null;
	public UncaseString(String str) {
		this.str = str;
	}
	public String toString(){
		return str;
	}
	@Override
	public int hashCode() {
		if(str==null)
			return super.hashCode();
		return str.hashCode();
	}
	@Override
	public boolean equals(Object obj) {
		if(this==obj)return true;
		if(obj==null)return str==null;
		else if(obj instanceof UncaseString){
			UncaseString c = (UncaseString) obj;
			if(c.str==null)return this.str==null;
			if(c.str==this.str)return true;
			return c.str.equalsIgnoreCase(str);
		}else if(obj instanceof String){
			if(obj==null)return str==null;
			return ((String) obj).equalsIgnoreCase(str);
		}else{
			obj = obj.toString();
			if(obj==null)return str==null;
			return ((String) obj).equalsIgnoreCase(str);
		}
	}
}
